;;! target = "riscv64"
;;!
;;! settings = ['enable_heap_access_spectre_mitigation=true']
;;!
;;! compile = true
;;!
;;! [globals.vmctx]
;;! type = "i64"
;;! vmctx = true
;;!
;;! [globals.heap_base]
;;! type = "i64"
;;! load = { base = "vmctx", offset = 0, readonly = true }
;;!
;;! [globals.heap_bound]
;;! type = "i64"
;;! load = { base = "vmctx", offset = 8, readonly = true }
;;!
;;! [[heaps]]
;;! base = "heap_base"
;;! min_size = 0x10000
;;! offset_guard_size = 0
;;! index_type = "i32"
;;! style = { kind = "dynamic", bound = "heap_bound" }

;; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
;; !!! GENERATED BY 'make-load-store-tests.sh' DO NOT EDIT !!!
;; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

(module
  (memory i32 1)

  (func (export "do_store") (param i32 i32)
    local.get 0
    local.get 1
    i32.store offset=0xffff0000)

  (func (export "do_load") (param i32) (result i32)
    local.get 0
    i32.load offset=0xffff0000))

;; function u0:0:
;; block0:
;;   uext.w a0,a0
;;   auipc t0,0; ld t0,12(t0); j 12; .8byte 0xffff0004
;;   add t2,a0,t0
;;   ult a3,t2,a0##ty=i64
;;   trap_if a3,heap_oob
;;   ld a3,8(a2)
;;   ld a2,0(a2)
;;   add a0,a2,a0
;;   auipc a2,0; ld a2,12(a2); j 12; .8byte 0xffff0000
;;   add a2,a0,a2
;;   ugt t2,t2,a3##ty=i64
;;   li a3,0
;;   selectif_spectre_guard a0,a3,a2##test=t2
;;   sw a1,0(a0)
;;   j label1
;; block1:
;;   ret
;;
;; function u0:1:
;; block0:
;;   uext.w a0,a0
;;   auipc t0,0; ld t0,12(t0); j 12; .8byte 0xffff0004
;;   add t2,a0,t0
;;   ult a2,t2,a0##ty=i64
;;   trap_if a2,heap_oob
;;   ld a2,8(a1)
;;   ld a1,0(a1)
;;   add a0,a1,a0
;;   auipc a1,0; ld a1,12(a1); j 12; .8byte 0xffff0000
;;   add a1,a0,a1
;;   ugt t2,t2,a2##ty=i64
;;   li a2,0
;;   selectif_spectre_guard a0,a2,a1##test=t2
;;   lw a0,0(a0)
;;   j label1
;; block1:
;;   ret